www.gusucode.com > Matlab在化学工程中的应用 > Matlab在化学工程中的应用/实用化工计算机模拟-Matlab在化学工程中的应用/Examples/Chapter 3/xFsolve.m
function xFsolve % xFsolve.m % 求解非线性方程组示例 % This program is used to demonstrate how to use function fsolve() % to solve a set of nonlinear equations % % Author: HUANG Huajiang % Copyright 2002 UNILAB Research Center, % East China University of Science and Technology, Shanghai, PRC % $Revision: 1.0 $ $Date: 2002/05/07 $ clear all clc x0 = [1 1]'; x1 = fsolve(@NonlinEqs,x0) x0 = [-0.1 2]'; x2 = fsolve(@NonlinEqs,x0) % ------------------------------------------------------------------ function f = NonlinEqs(x) f(1) = x(1)-4*x(1)*x(1)-x(1)*x(2); f(2) = 2*x(2)-x(2)*x(2)+3*x(1)*x(2);